<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@page import="com.mvc.security.model.Menu"%>
<%@ include file="/pages/common/header.jsp"%>
</head>
<body>
	<div class="contentBody contentborder">
		<div class="tab-pane" id="tabPane">
			<div id="message"><%=message %></div>
			<div class="tab-page" id="tabPage1">
				<h1 class="tab">菜单配置</h1>
				<div class="contentborder tableForm">
					<jdf:form bean="entity" scope="request">
						<form action="<%=dynamicDomain%>/menu/save" method="post">
							<input type="hidden" name="id">
							<input type="hidden" name="objectId">
							<table class="inputTable">
							    <tr class="BorderBottom">
									<td nowrap class="label cancelBorderLeft">
										<label for="type">类型：</label>
									</td>
									<td class="content">
										<select name="type" id="type">
											<jdf:select dictionaryId="106"/>
										</select>
									</td>
									<td nowrap class="label">
										<label for="name">名称：</label>
									</td>
									<td class="content">
										<input type="text" name="name">
									</td>
								</tr>
								<tr>
									<td nowrap class="label cancelBorderLeft">
										<label for="parentId">上级目录：</label>
									</td>
									<td class="content">
										<select name="parentId" style="width: 200px">
											<option value="0">--</option>
											<jdf:selectCollection items="pathes" optionValue="objectId" optionText="path"/>
										</select>
									</td>
									<td nowrap class="label">
										<label for="status">状态：</label>
									</td>
									<td class="content">
										<select name="status">
											<option value="">请选择</option>
											<jdf:select dictionaryId="103"/>
										</select>
									</td>
								</tr>
								<tr>
									<td nowrap class="label cancelBorderLeft">
										<label for="orderId">顺序：</label>
									</td>
									<td class="content" id="orderId">
										<input type="text" name="orderId">
									</td>
									<td nowrap class="label menuContent">
										<label for="serverId">服务：</label>
									</td>
									<td class="content menuContent">
										<select name="serverId">
											<jdf:selectCollection items="servers" optionValue="objectId" optionText="name"/>
										</select>
									</td>
								</tr>
								<tr class="menuContent">
									<td nowrap class="label cancelBorderLeft">
										<label for="displayPosition">展示位置：</label>
									</td>
									<td class="content">
										<select name="displayPosition">
											<jdf:select dictionaryId="124"/>
										</select>
									</td>
									<td nowrap class="label">
										<label for="url">链接：</label>
									</td>
									<td class="content">
										<input type="text" name="url">
									</td>
								</tr>
								<tr>
									<td class="bottomLabel" nowrap colspan="6">
										<div class="right">
											<button type="submit">提交</button>
											<c:if test="${not empty message}">
											<button type="button" onclick="toUrl('<%=dynamicDomain%>/menu/create')">继续增加</button>
											</c:if>
											<button type="button" onclick="toUrl('<%=dynamicDomain%>/menu/page')">返回</button>
										</div>
									</td>
								</tr>
							</table>
						</form>
					</jdf:form>
				</div>
			</div>
		</div>
	</div>
	<jdf:tableLabelValidate domain="Menu"/>
	<script type="text/javascript">
		function typeChange(){
			if($("#type").val()=="<%=Menu.TYPE_FOLDER%>"){
				$(".menuContent").hide();
				$("#orderId").attr("colspan",3);
			}else{
				$("#orderId").attr("colspan",1);
				$(".menuContent").show();
			}
		}
		$(document).ready(function(){
			$("#type").change(function(){
				typeChange();
			});
		});
		typeChange();
	</script>
</body>
</html>